<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib uri="/WEB-INF/tld/pms-tag.tld" prefix="mypms" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">

<link href="${ctx}/scripts/jscalendar-1.0/calendar-blue.css" rel="stylesheet" type="text/css">
<link href="${ctx}/scripts/jscalendar-1.0/calendar-blue2.css" rel="stylesheet" type="text/css">
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/calendar.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/lang/calendar-en.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/jscalendar-1.0/calendar-setup.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/common/prototype.js"></script>
<script language="JavaScript">
	function showChange(){
		var code = $('participantType').options[$('participantType').selectedIndex].code;
		if (code =="001"){
		document.getElementById("layer5").style.display="";
		document.getElementById("layer2").style.display="none";
		document.getElementById("layer3").style.display="";
		document.getElementById("layer4").style.display="";
		document.getElementById("layer6").style.display="";
		}
		else if(code == "002"){
		document.getElementById("layer5").style.display="none";
		document.getElementById("layer2").style.display="";
		document.getElementById("layer3").style.display="none";
		document.getElementById("layer4").style.display="none";
		document.getElementById("layer6").style.display="";
		}
		else
		{
		document.getElementById("layer1").style.display="";
		document.getElementById("layer5").style.display="none";
		document.getElementById("layer2").style.display="none";
		document.getElementById("layer3").style.display="none";
		document.getElementById("layer4").style.display="none";
		document.getElementById("layer6").style.display="none";
		}
	}

	function selectByType(objType,code){
		for(var i=0;i<objType.options.length;i++){
			if(objType.options[i].code==code){
				objType.selectedIndex=i;
				showChange();
				return;
			}
		}
	}
	function hideParticipantType(thiz){
		var objType=$('participantType');
		var code=thiz.options[thiz.selectedIndex].code;
		if( code == undefined || code == "" ){
			selectByType(objType,undefined);
			objType.disabled =true;
		}else if(code=='003' || code=='004'){
			selectByType(objType,'001');
			objType.disabled =true;
		}else{
			objType.disabled =false;
		}
	}

	function openChoiceHouse(){
		var url = "${ctx}/customer_chooseSingleHouseAction.do?method=chooseBuildingMain";
		windowOpen(url, "choiceHouse", "", 500, 650);
	}
	function setHouseInfo(houseId,houseNum){
		$('houseNumber').value=houseNum;
	}
	function submitSearch(){
		var url = "${ctx}/customer_hisResidentAction.do?method=setCustsearchVOCache";
		var param = formData();
		var myAjax = new Ajax.Request(
                    url,
                    {method: 'post', parameters: param, onComplete: showResponse}
                    );
	}
	function showResponse(){
		var obj=findFrame('main');
		obj.reLoadIFrameListWithQuery();
        windowClose();
    }
	function setSearchForm(){
		for(var i = 1 ; i<=5 ;i++){
			if(document.getElementById('layer'+i).style.display == 'none'){
				document.getElementById('layer'+i).removeNode(true);
			}
		}
	}
	function formData(){
	    setSearchForm();
		var object = document.getElementsByTagName("input");
		var customerCode = $('customerType').options[$('customerType').selectedIndex].code;
		if(customerCode =="003" || customerCode == '004')
			var str = "customerType="+$F('customerType')+"&";
		else
			var str = "customerType="+$F('customerType')+"&participantType="+$F('participantType')+"&";
		for(var i=0;i<object.length;i++){
			str =str+ object[i].name+"=" +object[i].value + "&";
		}
		return str;
	}
	function init(){
		$('participantType').disabled=true;
	}
</script>
</head>
<body onload="init();">
<form id="residentForm" action="${ctx}/customer_hisResidentAction.do?method=queryHisResInfo&type=search" method="post" >
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">高级查询</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" height="370" ""border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
          <tr>
            <td class="aux_intable_td1">房号：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input name="houseNumber" type="text" class="inputtext" size="16" value=""></td>
                <td width="4">&nbsp;</td>
                <td><a href="#"  onClick="openChoiceHouse();" onFocus="this.blur()"><img src="${ctx}/images/ico_houesno.GIF" alt="请点选查找房号" border="0"></a></td>
              </tr>
            </table></td>
            </tr>

          <tr>
            <td class="aux_intable_td1">住户类型：</td>
            <td class="aux_intable_td2">
            <mypms:Sysrefcode  name="customerType" filterStr="'001','002','003','004'" code="CS_CLIENT_CLIENT_TYPE" style="width:110px" onchange="hideParticipantType(this);"></mypms:Sysrefcode>
            </td>
            </tr>
          <tbody id="layer1" style="display:show;">
          <tr>
            <td class="aux_intable_td1">业主/租户类型：</td>
            <td class="aux_intable_td2">
             <mypms:Sysrefcode  name="participantType" code="CS_PARTICIPANT_TYPE" style="width:110px" onchange="showChange();">
            </mypms:Sysrefcode></td>
          </tr>
          </tbody>

          <tbody id="layer2" style="display:none;"  valign="top">
		  <tr>
            <td class="aux_intable_td1">单位名称：</td>
            <td class="aux_intable_td2"><input name="customerName" type="text" class="inputtext" value="" size="16"></td>
          </tr>
          </tbody>

          <tbody id="layer5" style="display:none;"  valign="top">
          <tr>
            <td class="aux_intable_td1">住户姓名：</td>
            <td class="aux_intable_td2"><input name="customerName" type="text" class="inputtext" value="" size="16"></td>
          </tr>
		  </tbody>

		  <tbody id="layer3" style="display:none;">
          <tr>
            <td class="aux_intable_td1">证件号码：</td>
            <td class="aux_intable_td2"><input name="idNO" value="" type="text" class="inputtext" size="16"></td>
          </tr>
          </tbody>

		  <tbody id="layer6" style="display:none;">
          <tr>
            <td class="aux_intable_td1">联系电话：</td>
            <td valign="top" class="aux_intable_td2"><input name="telephone"  type="text" class="inputtext" value="" size="16">            </td>
          </tr>
          <tr>
            <td class="aux_intable_td1">入住日期：</td>
            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input name="beginInDate" value="" type="text"  size="16" maxlength="10"></td>
                <td width="4">&nbsp;</td>
                <td><img name="beginInButton" src="${ctx}/images/ico_clock.gif" width="20" height="20"></td>
                <td>&nbsp;</td>
                <td>到</td>
                <td>&nbsp;</td>
                <td><input name="endInDate" value="" type="text"  size="16" maxlength="10"></td>
                <td>&nbsp;</td>
                <td><img name="endInButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" ></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td class="aux_intable_td1">搬出日期：</td>
            <td valign="top" class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input name="beginOutDate" value="" id="beginOutDate" type="text"  size="16" maxlength="10"></td>
                <td width="4">&nbsp;</td>
                <td><img name="beginOutButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" ></td>
                <td>&nbsp;</td>
                <td>到</td>
                <td>&nbsp;</td>
                <td><input name="endOutDate" value="" type="text"  size="16" maxlength="10"></td>
                <td>&nbsp;</td>
                <td><img name="endOutButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" ></td>
              </tr>
            </table></td>
          </tr>
		  </tbody>

          <tbody id="layer4" style="display:none;">
          <tr>
            <td class="aux_intable_td1">籍贯：</td>
            <td valign="top" class="aux_intable_td2"><input name="nativePlace" value="" type="text" class="inputtext" value="" size="16"></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">职业：</td>
            <td valign="top" class="aux_intable_td2"><input name="profession" value="" type="text" class="inputtext" value="" size="16"></td>
          </tr>

          <tr>
            <td class="aux_intable_td1">兴趣爱好：</td>
            <td valign="top" class="aux_intable_td2"><input name="beInterestingIn" value="" type="text" class="inputtext" value="" size="16"></td>
          </tr>
          <tr>
            <td class="aux_intable_td1">出入证号码：</td>
            <td valign="top" class="aux_intable_td2"><input name="passport" value="" type="text" class="inputtext" value="" size="16"></td>
          </tr>
          </tbody>
 </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="submitSearch();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom"> 确 定</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom"> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<script type="text/javascript">
              Calendar.setup(
              {
	              inputField : "beginInDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginInButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
               Calendar.setup(
              {
	              inputField : "endInDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endInButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
               Calendar.setup(
              {
	              inputField : "beginOutDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "beginOutButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
               Calendar.setup(
              {
	              inputField : "endOutDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "endOutButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
</script>
</body>
</html>